﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class Fotografii : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
    {

       
        int i= Convert.ToInt32(GridView1.SelectedRow.Cells[0].Text);


        //////prikazuva slika golema--------------------

        SqlConnection myConnection = new SqlConnection();
        myConnection.ConnectionString = ConfigurationManager.ConnectionStrings["Konekcija"].ConnectionString;

        string sqlQuestion2 = "SELECT * FROM Photos WHERE ID=@ID";

        SqlCommand komanda2 = new SqlCommand(sqlQuestion2, myConnection);

        komanda2.Parameters.AddWithValue("@ID",i);
        SqlDataReader citac2;

            myConnection.Open();
            citac2 = komanda2.ExecuteReader();
            while (citac2.Read())
            {
                Response.Redirect("PrikazSlika.aspx?id="+i);
            }
            myConnection.Close();
    }
}
